<extend name="common:commonNewerTemplate" />
<block name="main_content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a class="tip-bottom" href="index.html"
				data-original-title="Go to Home"><i class="icon-home"></i> 首页</a> <a
				href="#">四川电信渠道业务员管理</a> <a class="current" href="#">四川电信渠道业务员详情</a>
		</div>
	</div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"> <i class="icon-info-sign"></i>
						</span>
						<h5>四川电信渠道业务员信息</h5>
					</div>
					<div class="widget-content nopadding">
						<form novalidate="novalidate" id="basic_validate"
							name="basic_validate" action="#" method="post"
							class="form-horizontal">
							
							<div class="control-group">
								<label class="control-label">业务员编号:</label>
								<div class="controls">
									<input type="text" id="sale_id" name="sale_id" value="{$sale_info.sale_id}"   readonly="readonly" /><span style="color:red;">*</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">用户名:</label>
								<div class="controls">
									<input type="text" id="sale_name" name="sale_name" value="{$sale_info.sale_name}" /><span style="color:red;">*</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">用户真实姓名:</label>
								<div class="controls">
									<input type="text" id="sale_real_name" name="sale_real_name" value="{$sale_info.sale_real_name}"  /><span style="color:red;">*</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">手机号码:</label>
								<div class="controls">
									<input type="text" id="sale_mobile" name="sale_mobile" value="{$sale_info.sale_mobile}"  /><span style="color:red;">*</span>
								</div>
							</div>
							 <div class="control-group">
								<label class="control-label">大区:</label>
								<div class="controls">
									<input type="text" id="area_name" name="area_name" value="{$sale_info.area_name}"/><span style="color:red;">*</span>
								</div>
							 </div>
							 
							  <div class="control-group">
                                    <label class="control-label">省市区</label>
                                    <input type="hidden" id="temp_province" name="province_name" value="{$sale_info.province_id}">
                                    <input type="hidden" id="temp_city" name="city_name" value="{$sale_info.city_id}">
                                    <input type="hidden" id="temp_district" name="district_name" value="{$sale_info.district_id}">   

                                    <div class="controls">
                                        <select id="ssl_province" name="province_id" style="width:240px;">
                                        </select>


                                        <select id="ssl_city" name="city_id" style="width:240px;">
                                        </select>
                                         
                                         <select id="ssl_district" name="district_id" style="width:240px;">
                                        </select><span style="color:red;">*</span>
                                   
                                    </div>
                                </div>
                            
                                  
                            <div class="control-group">
								<label class="control-label">部门:</label>
								<div class="controls">
									<input type="text" id="department" name="department" value="{$sale_info.department}"/>
								</div>
							 </div>    
                                 <div class="control-group">
								<label class="control-label">职能:</label>
								<div class="controls">
									<input type="text" id="occupation" name="occupation" value="{$sale_info.occupation}"/>
								</div>
							 </div>
							 <div class="control-group">
								<label class="control-label">负责区域:</label>
								<div class="controls">
									<input type="text" id="resp_area" name="resp_area" value="{$sale_info.resp_area}"/>
								</div>
							 </div>
							 <div class="control-group">
								<label class="control-label">邮箱地址:</label>
								<div class="controls">
									<input type="text" id="email_address" name="email_address" value="{$sale_info.email_address}" placeholder="可以为空，不为空强校验唯一性"/>
								</div>
							 </div>
                                
   
                                
							<div class="control-group">
								<label class="control-label">地址:</label>
								<div class="controls">
									<input type="text" id="sale_address" name="sale_address" value="{$sale_info.sale_address}"  />
								</div>
							</div>
							 <div class="control-group">
								<label class="control-label">备注:</label>
								<div class="controls">
									<input type="text" id="remark" name="remark" value="{$sale_info.remark}">
								</div>
							</div>   
							<div class="control-group">
								<label class="control-label">密码:</label>
								<div class="controls">
									<input type="password" placeholder="输入密码修改，不输入不变"  
										id="password" name="password"/>
								</div>
							</div>
							
							<div class="control-group">
								<a id="btn_update_sale" class="btn btn-success">修改</a> 
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</block>

<block name="js_content"> <script>
		//修改商品
		$('#btn_update_sale').bind('click', function(){
			
			var province_name = $('#ssl_province').find("option:selected").text();		
			var city_name = $('#ssl_city').find("option:selected").text();
			var district_name= $('#ssl_district').find("option:selected").text();
			
			$('#temp_province').val(province_name);
			$('#temp_city').val(city_name);
			$('#temp_district').val(district_name);
			
			  var condition = $("#basic_validate").serialize();
			     

		      $.ajax({
		          type: 'post',
		          url: '/AjaxService/center/sale/updatesale',
		          data: condition,
		          dataType: 'json',
		          async: false,
		          success: function (data) {
		              if (data.IsSuccess == 0) {
		                  alert(data.ErrorMsg);
		                  return;
		              } else {
		                  alert('修改成功');
		              }
		          },
		          error: function (e, err_name, err_text) {

		          }
		      });
		});
		$(document).ready(function () {
		    CommonPage.InitRegion();
		   

		    //设置省市区
		    if($("#temp_province").val()){
		        $('#ssl_province').val($("#temp_province").val());
		        $('#ssl_province').trigger('change');
		    }
		    if($("#temp_city").val()){
		        $('#ssl_city').val($("#temp_city").val());
		        $('#ssl_city').trigger('change');
		    }
		    if($("#temp_district").val()){
		        $('#ssl_district').val($("#temp_district").val());
		        $('#ssl_district').trigger('change');
		    } 
		});
</script> 
</block>